package org.yanghe.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class FlowLimitController {

    @GetMapping(value = "/testA")
    public String testA(){
        return "testA";
    }

    @GetMapping(value = "/testB")
    public String testB(){
        return "testB";
    }

    @GetMapping(value = "/testC")
    public String testC(int id) throws InterruptedException {
        if(id<0){
            TimeUnit.SECONDS.sleep(1);
        }
        return "testC";
    }

    @GetMapping(value = "/testD")
    public String testD(int id){
        if(id<0){
            throw new RuntimeException("运行异常");
        }
        return "testD";
    }
}
